package com.lovo.proxy;

import java.lang.reflect.Proxy;

public class AdminMain {
    public static void main(String[] args) {
//        AdminControl target = new AdminControlImpl();


        //静态
//        AdminControl adminControl = new AdminControlProxy(target);

//        动态
//        AdminControl adminControl = (AdminControl) Proxy.newProxyInstance(AdminControlImpl.class.getClassLoader(),
//                AdminControlImpl.class.getInterfaces(),
//                new AdminControlInvocation(target));

//        cglib

        AdminControlImpl target = new AdminControlImpl();
        AdminControlImpl adminControl = (AdminControlImpl) new AdminControlCglibProxy(target).getProxyInstance();
        adminControl.find();
        adminControl.update();
        adminControl.add();
    }
}
